package com.praxinfosystems.sarthak.common;

import java.util.Collection;
import java.util.HashSet;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

public class AuthenticatedUserDetails implements UserDetails {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String userName;
    private String password;
    private Collection<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
    boolean accountNonExpired;
    boolean accountNonLocked;
    boolean credentialsNonExpired;
    boolean enabled;
//    private GrantedAuthority authorities;
    
    public AuthenticatedUserDetails(String username, String password, Collection<GrantedAuthority> authorities,boolean accountNonExpired, boolean accountNonLocked, boolean credentialsNonExpired,boolean enabled){
    	this.userName=username;
    	this.password=password;
    	this.authorities=authorities;
    	this.accountNonExpired=accountNonExpired;
    	this.accountNonLocked=accountNonLocked;
    	this.credentialsNonExpired=credentialsNonExpired;
    	this.enabled=enabled;
    }

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		return this.authorities;
	}

	@Override
	public String getPassword() {
		return this.password;
	}

	@Override
	public String getUsername() {
		return this.userName;
	}

	@Override
	public boolean isAccountNonExpired() {
		return this.accountNonExpired;
	}

	@Override
	public boolean isAccountNonLocked() {
		return this.accountNonLocked;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		return this.credentialsNonExpired;
	}

	@Override
	public boolean isEnabled() {
		return this.enabled;
	}

}
